﻿@model List<BO.Account>

@{
    Layout = null;

    var index = 0;
}

<!DOCTYPE html>

<html>
<head>
    <title>Index</title>
    <script src="../../Scripts/jquery-1.4.4.js" type="text/javascript"></script>
    <link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
    <link href="../../Content/General.css" rel="stylesheet" type="text/css" />

    <style>
        table td
        {
            max-width:200px;
            overflow:hidden;
        }
    </style>
    <script>
        function newFB()
        {
            window.open("/facebook/oauth", "facebook", "width=600px,height=400px");
        }

        function newTw()
        {
            window.open("/twitter/oauth", "twitter", "width=600px,height=400px");
        }

        function callback()
        {
            window.location.reload();
        }

//        function addPage(key, cell)
//        {
//            $.ajax({
//                url: "facebook/pages",
//                data: { key: key },
//                success: function (pages)
//                {
//                    var select = $("<select>");
//                    for (var i = 0; i < pages.length; i++)
//                    {
//                        var option = $("<option>");
//                        option.append(pages[i].name);
//                        option.attr('value', pages[i].id);
//                        select.append(option);
//                    }
//                    $(cell).append(select);
//                }
//            });
//        }

    </script>

</head>
<body>
    <div>
        <table style="width:1000px">
            <thead>
                <tr class="Header">
                    <th>Name</th>
                    <th>FBKey</th>
                    <th>FBSecret</th>
                    <th>TwKey</th>
                    <th>TSecret</th>
                    @*<th>Add Page</th>*@
                </tr>
            </thead>

            <tbody>
                @foreach (var a in Model)
                {
                    <tr class="@(index++%2==1? "Odd": "")">
                    <td>@a.Name</td>
                    <td>@a.FBKey</td>
                    <td>@a.FBSecret</td>
                    <td>@a.TwKey</td>
                    <td>@a.TwSecret</td>
                    @*<td>
                        @if (a.Type == Logic.Enums.AccountType.Facebook)
                        {
                            <input type="button" value="Add Page" onclick="AddPage(@a.FBKey)"/>
                        }
                    </td>*@
                </tr>
                }
            </tbody>
        </table>
        
        <input type="button" value="Add new Facebook" onclick="newFB()" />
        <input type="button" value="Add new Twitter" onclick="newTw()" />  
    </div>
</body>
</html>
